package com.wnhz.work.yz.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.wnhz.work.yz.BaseActivity;
import com.wnhz.work.yz.MainActivity;
import com.wnhz.work.yz.R;

/**
 * ---支付成功
 */
public class PaySuccessActivity extends BaseActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pay_success);

        initData();
        initView();
    }

    private String str_number, str_tiem, str_price;

    private void initData() {
        str_number = getIntent().getStringExtra("str_number");
        str_tiem = getIntent().getStringExtra("str_tiem");
        str_price = getIntent().getStringExtra("str_price");
    }

    private TextView tv_order_number, tv_order_time, tv_pay_price;

    private void initView() {
        findViewById(R.id.tv_back_home).setOnClickListener(this);//返回首页
        findViewById(R.id.tv_look_order).setOnClickListener(this);//查看订单
        tv_order_number = (TextView) findViewById(R.id.tv_order_number);
        tv_order_time = (TextView) findViewById(R.id.tv_order_time);
        tv_pay_price = (TextView) findViewById(R.id.tv_pay_price);
        tv_order_number.setText(str_number + "");
        tv_order_time.setText(str_tiem + "");
        tv_pay_price.setText("¥ " + str_price + "");
    }

    @Override
    public void onClick(View v) {
        Intent intent;
        switch (v.getId()) {
            //返回首页
            case R.id.tv_back_home:
                intent = new Intent(this, MainActivity.class);
                intent.putExtra("Pagination", "0");
                startActivity(intent);
                break;

            //查看订单
            case R.id.tv_look_order:
                MyToast("查看订单");
                break;
            default:
                break;
        }
    }
}
